/**
 * 位运算
 */
public class bitOperation {
    public static void bitPrint(String str, int num) {
        System.out.println(str);
        for (int i = 31; i >= 0; i--) {
            System.out.print((num & (1 << i)) == 0 ? "0" : "1");
        }
        System.out.println();
    }

    public static void main(String[] args) {
        int num = -1314520;
        int value = 1314520;
        int and = num & value;
        int or = num | value;
        int not = ~value;
        int XOR = num ^ value;
        int leftMove = num << 1;
        int rightMove1 = num >>> 1;
        int rightMove2 = num >> 1;
        bitPrint("二进制num", num);
        bitPrint("二进制value", value);
        bitPrint("num与value 与运算", and);
        bitPrint("num与value 或运算", or);
        bitPrint("value 非运算", not);
        bitPrint("num与value 异或运算", XOR);
        bitPrint("num 左移", leftMove);
        bitPrint("num 不带符号右移", rightMove1);
        bitPrint("num 带符号右移", rightMove2);
        dome(num);
    }
    //练习
    public static void dome(int num) {

    }





}












